<template>
  	<el-row  >
  		<el-row class='text-left mt12  mb10'>债权转让-搬经城镇-临江投资（20181126）</el-row>
  		<el-row>
  			<el-col  :span='6'>
  				<el-input class='mt6 mb10'
			  	      placeholder="输入关键字进行过滤"
			  	      v-model="filterText">
		  	    </el-input>
		  	    <el-tree 
			          :data="treedata"
			          node-key="id"
			          default-expand-all
			          :props="defaultProps"
			          expand-on-click-node
			          :filter-node-method="filterNode"
			          ref="tree">
			          
		        </el-tree>
  			</el-col>
  			<el-col  :span='17' :offset='1'>
  				<el-card shadow="hover">
			      		<div class=' w-100 ' align='left'>
		                        <el-input class='w-30' placeholder='请输入' v-model='search.name'></el-input>
		                        <el-button icon="el-icon-search" type='primary' @click=''>搜索</el-button>
		                </div>
		                <!-- table -->
					    <el-table   :data="tableList"   :cell-class-name='hover'  @cell-click='checkUser' >
					        	 
					          <el-table-column prop="name"            label="名称"     align="" >
					          		<template slot-scope='list' >
					          			<i  class='icon icon-filefolder  align-text-top' ></i>
					                      {{list.row.name}}
					                </template>
					          </el-table-column>
					          <el-table-column prop="prjType"            label="产品"     align="center" >
					                <template slot-scope='list'>
					                      {{list.row.prjType | project_type}}
					                </template>
					          </el-table-column>
					          <el-table-column prop="entMemberType"            label="标的"     align="center"  ></el-table-column>
					          <el-table-column prop="entMemberType"            label="签署状态"     align="center"  ></el-table-column>
					          <el-table-column prop="modifyTime"      label="更新时间"     align="center"  >
					                <template slot-scope="scope">
					                      {{scope.row.modifyTime | formatDate}}
					                </template>
					          </el-table-column>
					          <el-table-column prop="cretaeUserName"  label="发起人"       align="center"  ></el-table-column>
					         <el-table-column                        label="操作"          align="center"  >
					                  <template v-slot="list">
					                          <el-button  type="primary" size="mini" round @click="downloadFile(list.row.code)" >下载</el-button>
					                          
					                  </template>
					          </el-table-column>
					    </el-table>
			    </el-card>
  				
  			</el-col>
  		</el-row>
  	</el-row>
</template>

<script>
export default {
  name: 'pro_contract_item',
  data () {
    return {
      treedata:[{
          label: '一级 1',
          children: [{
            label: '二级 1-1',
            children: [{
              label: '三级 1-1-1'
            }]
          }]
        }, {
          label: '一级 2',
          children: [{
            label: '二级 2-1',
            children: [{
              label: '三级 2-1-1'
            }]
          }, {
            label: '二级 2-2',
            children: [{
              label: '三级 2-2-1'
            }]
          }]
        }, {
          label: '一级 3',
          children: [{
            label: '二级 3-1',
            children: [{
              label: '三级 3-1-1'
            }]
          }, {
            label: '二级 3-2',
            children: [{
              label: '三级 3-2-1'
            }]
          }]
        }],
        defaultProps: {
          children: 'children',
          label: 'label'
        },
       filterText: '',
       search:{

       },
       tableList:[{name:'dsa'}],
    }
  },
  methods:{
  	filterNode(value, data) {
        // console.log(value,data)
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },
      hover({row, column, rowIndex, columnIndex}){
	    //console.log(row, column, rowIndex, columnIndex)
	    //设置表格第一列的特殊样式  该样式需要在APP 或者 public.css设置
	      if(columnIndex == 0 ){
	        return 'activeCol'
	      }
	    },
	    //点击表格第一列  查看详情
	    checkUser(row, column, cell, event){
	    	if(column.label == '名称'){
	    			if(row.isDir == '1'){
		        		this.search.dirCode = row.code
		        		this.initPath(row.code,row.name)
						this.pageInit()
	        		}
	        		if(row.isDir == '0'){
	        			this.search.dirCode = row.code
		        		this.initPath(row.code,row.name)
		        		//waiting......
		        		// DetailFile(row.code).then(res=>{
		        		// 	console.log(res)
		        		// })
	        		}
	    	}
	        
	    },
  },
   watch: {
      filterText(val) {
        this.$refs.tree.filter(val);
      }
    },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
